/**
 * Tetromino.h
 * Cocoa Tetris
 *
 * Copyright 2009 Wei Yeh, Evelyn Yung. All rights reserved.
 */

#import <Cocoa/Cocoa.h>

@class Cell;
@class Board;

@interface Tetromino : NSObject {
	NSColor *myColor;
	NSMutableArray *myCells;
	Board *myBoard;
	unsigned int myRotationCount;
}

/** Must be overriden by subclasses. */
-(id)initAtY:(unsigned int)y x:(unsigned int)x check:(bool)check;

-(bool)setUp;
/** Creates and returns a random new Tetromino. */
+(Tetromino *)randomTetromino;

-(NSColor *)color;
+(CGFloat)size;

-(void)unmarkCell:(Cell *)cell;

-(NSMutableArray *)transform:(BOOL)check;
-(void)rotate;
-(void)moveDown;
-(void)moveLeft;
-(void)moveRight;
-(void)drop;
/** List of new cells resulting from moving me by the given amounts. */
-(NSMutableArray *)moveByY:(unsigned int)y x:(unsigned int)x;
/** List of new cells resulting from moving me by the amounts in the given arrays. */
-(NSMutableArray *)moveByArrayY:(int *)arrY arrayX:(int *)arrX;
/** Move me to the new cells. */
-(void)moveToNewCells:(NSMutableArray *)newCells;
/**
 * Moves a single cell down.
 * In other words, unmark the current cell and mark the cell directly underneath.
 * Pre-condition: Can move down this unit.
 */
-(void)moveDownUnit:(Cell *)oldCell;

-(bool)canRotate;
-(bool)canMoveDown;
-(bool)canMoveLeft;
-(bool)canMoveRight;
-(bool)canMoveToNewCells:(NSMutableArray *)newCells;

@end

@interface IBlock : Tetromino {} @end
@interface OBlock : Tetromino {} @end
@interface TBlock : Tetromino {} @end
@interface JBlock : Tetromino {} @end
@interface LBlock : Tetromino {} @end
@interface SBlock : Tetromino {} @end
@interface ZBlock : Tetromino {} @end
